package com.zzyl.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.zzyl.dto.NursingPlanProjectDto;
import com.zzyl.entity.NursingPlanProject;
import com.zzyl.mapper.NursingProjectPlanMapper;
import com.zzyl.service.NursingProjectPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class NursingProjectPlanServiceimpl implements NursingProjectPlanService {
    @Autowired
    private NursingProjectPlanMapper nursingProjectPlanMapper;

    @Override
    public void insertListProject(List<NursingPlanProjectDto> projectPlans) {
        List<NursingPlanProject> projectList = projectPlans.stream().map(v -> BeanUtil.toBean(v, NursingPlanProject.class)).collect(Collectors.toList());
        nursingProjectPlanMapper.insertList(projectList);

    }

    @Override
    public void deleteByids(List<Long> ids) {
        nursingProjectPlanMapper.deletebyids(ids);
    }

    @Override
    public void deleteByid(Long id) {
        nursingProjectPlanMapper.deleteprojectPlan(id);
    }
}
